import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
    state: {
        userInfo: {}
    },
    mutations: {
        undate(state, date) {
            state.userInfo = date;
            localStorage.setItem('userInfo', JSON.stringify(date));
        }
    },
    getters: {
        newUser(state) {
            store.commit('undate', JSON.parse(localStorage.getItem('userInfo')));
            return state.userInfo;
        }
    },

})
export default store;